
#include "hash.h"

StrHash
hash_from_str( const char * src_str, size_t len )
{
    const unsigned char * str = (const unsigned char *)src_str;
    size_t n = len;
    StrHash h = 0;
    StrHash g;

    while( n-- )
    {
        h = (h << 4) + *str++;
        if ((g = (h & 0xf0000000)) != 0)
            h ^= g >> 23;
        h &= ~g;
    }

    return h;
}
